diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d0a0ff4933e..7f46105596e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -149,7 +149,7 @@ jobs: - name: cargo clippy if: (needs.changes.result != 'success' || needs.changes.outputs.rust == 'true') && needs.changes.outputs.rust_full != 'false' - run: cargo clippy --locked -p celox-test-suite -p celox -p celox-frontend-core -p celox-frontend-sv -p celox-frontend-veryl -p celox-macros -p celox-napi -p celox-sv-analyzer -p celox-ts-gen -p celox-vpi -p lydite-ir -p lydite -p lydite-celox -p lydite-solver -p lydite-syntax -p lydite-verify --all-targets --features celox/systemverilog,celox-test-suite/verilator,celox-test-suite/icarus --no-deps + run: cargo clippy --locked --workspace --all-targets --features celox/systemverilog,celox-test-suite/verilator,celox-test-suite/icarus --no-deps - name: Lint the crates this pull request can affect if: needs.changes.outputs.rust_full == 'false' && needs.changes.outputs.rust_lint_packages != '' @@ -402,7 +402,7 @@ jobs: - uses: actions/setup-python@v7 with: - python-version: "3.13" + python-version: "3.14" - name: Install the official runner dependency run: python -m pip install -r conformance/sv-tests/requirements.txt diff --git a/clippy.toml b/clippy.toml index 1f90a0a382c..7d2bbf4515e 100644 --- a/clippy.toml +++ b/clippy.toml @@ -1,4 +1,5 @@ disallowed-macros = [ + { path = "std::thread_local", reason = "production state must be owned and passed explicitly; only test-local instrumentation may opt out" }, { path = "std::eprintln", reason = "library diagnostics must use tracing or a caller-provided writer" }, ] diff --git a/crates/celox-backend-arm64/src/lib.rs b/crates/celox-backend-arm64/src/lib.rs index fa94d1052ec..f8f4ae0dc6e 100644 --- a/crates/celox-backend-arm64/src/lib.rs +++ b/crates/celox-backend-arm64/src/lib.rs @@ -1,3 +1,10 @@ +#![cfg_attr( + test, + allow( + clippy::disallowed_macros, + reason = "thread-local instrumentation exists only in unit tests; non-test library builds enforce the ban" + ) +)] //! Self-contained AArch64 code-generation backend. //! //! Production code lowers source-independent SIR directly into AArch64-owned diff --git a/crates/celox-backend-x86/src/lib.rs b/crates/celox-backend-x86/src/lib.rs index d115f5e3183..0a0c7d7f230 100644 --- a/crates/celox-backend-x86/src/lib.rs +++ b/crates/celox-backend-x86/src/lib.rs @@ -1,3 +1,10 @@ +#![cfg_attr( + test, + allow( + clippy::disallowed_macros, + reason = "thread-local instrumentation exists only in unit tests; non-test library builds enforce the ban" + ) +)] //! Self-contained x86-64 code-generation kernel. //! //! The crate consumes source-independent SIR plus a finalized physical state diff --git a/crates/celox-bench/src/bin/celox-heliodor.rs b/crates/celox-bench/src/bin/celox-heliodor.rs index 0c21f30568a..caea5040226 100644 --- a/crates/celox-bench/src/bin/celox-heliodor.rs +++ b/crates/celox-bench/src/bin/celox-heliodor.rs @@ -1,5 +1,4 @@ -#![allow(clippy::disallowed_macros)] // CLI errors and progress intentionally use stderr - +use std::io::Write as _; use std::{ fs, path::{Path, PathBuf}, @@ -176,7 +175,7 @@ fn main() { .with_ansi(false) .init(); if let Err(e) = run() { - eprintln!("error: {e}"); + let _ = writeln!(std::io::stderr().lock(), "error: {e}"); std::process::exit(1); } } @@ -393,7 +392,7 @@ fn run() -> Result<(), CeloxHeliodorError> { ) { Ok(cache) => Some(cache), Err(error) => { - eprintln!("build cache disabled: {error}"); + let _ = writeln!(std::io::stderr().lock(), "build cache disabled: {error}"); println!("CELOX_BUILD_CACHE test={} status=bypass", opts.test); None } @@ -494,7 +493,8 @@ fn run() -> Result<(), CeloxHeliodorError> { let sir = trace.format_post_optimized_sir(); if let Some(pre_optimized_sir) = &pre_optimized_sir { fs::write(&pre_sir_path, pre_optimized_sir)?; - eprintln!( + let _ = writeln!( + std::io::stderr().lock(), "wrote pre-optimized SIR ({} bytes) to {}", pre_optimized_sir.len(), pre_sir_path.display() @@ -502,7 +502,8 @@ fn run() -> Result<(), CeloxHeliodorError> { } if let Some(sir) = &sir { fs::write(&sir_path, sir)?; - eprintln!( + let _ = writeln!( + std::io::stderr().lock(), "wrote post-optimized SIR ({} bytes) to {}", sir.len(), sir_path.display() @@ -547,22 +548,26 @@ fn run() -> Result<(), CeloxHeliodorError> { fs::write(&mir_path, &mir)?; fs::write(&reactive_graph_path, &reactive_graph)?; fs::write(&state_layout_path, &state_layout)?; - eprintln!( + let _ = writeln!( + std::io::stderr().lock(), "wrote native optimized SIR ({} bytes) to {}", native_sir.len(), native_sir_path.display() ); - eprintln!( + let _ = writeln!( + std::io::stderr().lock(), "wrote full native MIR ({} bytes) to {}", mir.len(), mir_path.display() ); - eprintln!( + let _ = writeln!( + std::io::stderr().lock(), "wrote reactive event graph ({} bytes) to {}", reactive_graph.len(), reactive_graph_path.display() ); - eprintln!( + let _ = writeln!( + std::io::stderr().lock(), "wrote native state-layout analysis ({} bytes) to {}", state_layout.len(), state_layout_path.display() diff --git a/crates/celox-bench/src/bin/celox-rica.rs b/crates/celox-bench/src/bin/celox-rica.rs index 0991dcadb6a..0beb185bcc8 100644 --- a/crates/celox-bench/src/bin/celox-rica.rs +++ b/crates/celox-bench/src/bin/celox-rica.rs @@ -1,5 +1,3 @@ -#![allow(clippy::disallowed_macros)] // CLI errors and progress intentionally use stderr - //! Run a Rica ELF on the `HardwareCoreTestTop` board-memory model with Celox //! and report split benchmark timing. //! @@ -10,6 +8,7 @@ //! mirrors `--timed-clocks`, which evaluates coincident edges atomically with //! the timed scheduler. +use std::io::Write as _; use std::{ collections::BTreeMap, fs, @@ -795,7 +794,7 @@ fn report( fn main() { if let Err(error) = run(Cli::parse()) { - eprintln!("error: {error}"); + let _ = writeln!(std::io::stderr().lock(), "error: {error}"); std::process::exit(1); } } @@ -888,7 +887,12 @@ fn run(cli: Cli) -> Result<(), RicaError> { let text = text.ok_or_else(|| message(format!("{name} was not captured")))?; let path = output_dir.join(name); fs::write(&path, &text)?; - eprintln!("wrote {name} ({} bytes) to {}", text.len(), path.display()); + let _ = writeln!( + std::io::stderr().lock(), + "wrote {name} ({} bytes) to {}", + text.len(), + path.display() + ); } compiled.into_program_image() } else { diff --git a/crates/celox-bench/src/bin/heliodor/build_cache.rs b/crates/celox-bench/src/bin/heliodor/build_cache.rs index b74c1e5bec3..613e63f3cbd 100644 --- a/crates/celox-bench/src/bin/heliodor/build_cache.rs +++ b/crates/celox-bench/src/bin/heliodor/build_cache.rs @@ -377,7 +377,11 @@ impl BuildCache { match self.try_load() { Ok(image) => image, Err(error) => { - eprintln!("build cache ignored {}: {error}", self.path.display()); + let _ = writeln!( + std::io::stderr().lock(), + "build cache ignored {}: {error}", + self.path.display() + ); None } } @@ -423,7 +427,11 @@ impl BuildCache { pub(super) fn store(&self, image: &NativeProgramImage, dependencies: &[FileDependency]) { if let Err(error) = self.try_store(image, dependencies) { - eprintln!("build cache write skipped {}: {error}", self.path.display()); + let _ = writeln!( + std::io::stderr().lock(), + "build cache write skipped {}: {error}", + self.path.display() + ); } } diff --git a/crates/celox-bench/src/bin/parallel-report.rs b/crates/celox-bench/src/bin/parallel-report.rs index 36ec37f0ffa..bd392a13e31 100644 --- a/crates/celox-bench/src/bin/parallel-report.rs +++ b/crates/celox-bench/src/bin/parallel-report.rs @@ -1,9 +1,9 @@ //! Capture compiler decisions and real lane execution into an offline report. -#![allow(clippy::disallowed_macros)] use celox::{SimBackend, Simulator}; use clap::{Parser, ValueEnum}; use serde_json::{Value, json}; +use std::io::Write as _; use std::{ collections::BTreeMap, fs, @@ -201,7 +201,8 @@ impl LookupSpan<'a>> Layer for Capture { } let mut events = self.events.lock().unwrap(); if events.len().is_multiple_of(100_000) { - eprintln!( + let _ = writeln!( + std::io::stderr().lock(), "Captured {} records; event {}", events.len(), fields.0.get("event").unwrap_or(&Value::Null) @@ -333,7 +334,8 @@ fn exercise_testbench( celox::testbench::compile_initial_testbench(&sim).ok_or("No initial testbench found")?; window.active.store(false, Ordering::Relaxed); window.running.store(true, Ordering::Relaxed); - eprintln!( + let _ = writeln!( + std::io::stderr().lock(), "Running {} for up to {ticks} ticks; capture kernel calls {}..{}", args.top, window.after + 1, diff --git a/crates/celox-bench/src/bin/veryl-heliodor.rs b/crates/celox-bench/src/bin/veryl-heliodor.rs index e20269dae99..ff1408f3838 100644 --- a/crates/celox-bench/src/bin/veryl-heliodor.rs +++ b/crates/celox-bench/src/bin/veryl-heliodor.rs @@ -1,5 +1,4 @@ -#![allow(clippy::disallowed_macros)] // CLI errors intentionally use stderr - +use std::io::Write as _; use std::{fs, path::PathBuf, time::Instant}; use clap::Parser as ClapParser; @@ -52,7 +51,7 @@ enum VerylHeliodorError { fn main() { if let Err(error) = run() { - eprintln!("error: {error}"); + let _ = writeln!(std::io::stderr().lock(), "error: {error}"); std::process::exit(1); } } diff --git a/crates/celox-sv-analyzer/src/lib.rs b/crates/celox-sv-analyzer/src/lib.rs index 57984998a85..3297d4397cd 100644 --- a/crates/celox-sv-analyzer/src/lib.rs +++ b/crates/celox-sv-analyzer/src/lib.rs @@ -1,3 +1,10 @@ +#![cfg_attr( + test, + allow( + clippy::disallowed_macros, + reason = "thread-local counters exist only in unit tests; non-test library builds enforce the ban" + ) +)] //! SystemVerilog analyzer for Celox. //! //! Native syntax and source storage belong to [`celox_sv_syntax`]. This crate diff --git a/crates/celox/examples/sv_tests.rs b/crates/celox/examples/sv_tests.rs index fe465e1cfa6..6f0f9f89a84 100644 --- a/crates/celox/examples/sv_tests.rs +++ b/crates/celox/examples/sv_tests.rs @@ -9,7 +9,6 @@ //! ``` #![allow(clippy::disallowed_methods)] // This binary is the process environment boundary. -#![allow(clippy::disallowed_macros)] // Driver diagnostics intentionally use stderr. use std::{collections::BTreeSet, env, path::PathBuf, process::ExitCode}; @@ -227,6 +226,7 @@ fn simulate(mut sim: celox::Simulation) -> Result<(), String> { Ok(()) } +#[allow(clippy::disallowed_macros)] // CLI diagnostics intentionally use stderr. fn main() -> ExitCode { let args: Vec = env::args().skip(1).collect(); if args.as_slice() == ["--version"] { diff --git a/crates/celox/src/lib.rs b/crates/celox/src/lib.rs index 6eaacd85096..892bc41a031 100644 --- a/crates/celox/src/lib.rs +++ b/crates/celox/src/lib.rs @@ -1,3 +1,10 @@ +#![cfg_attr( + test, + allow( + clippy::disallowed_macros, + reason = "thread-local instrumentation exists only in unit tests; non-test library builds enforce the ban" + ) +)] mod backend; #[cfg(all(feature = "arm64-codegen", feature = "x86_64-codegen"))] compile_error!("arm64-codegen and x86_64-codegen cannot be enabled together"); diff --git a/crates/lydite-celox/clippy.toml b/crates/lydite-celox/clippy.toml index 5d4803ff5b1..0bede155ba9 100644 --- a/crates/lydite-celox/clippy.toml +++ b/crates/lydite-celox/clippy.toml @@ -1,2 +1,7 @@ # lydite is a standalone verifier CLI: Celox's simulator-library rules in the # workspace clippy.toml (no env reads, no eprintln, Fx hash maps) do not apply. + +# Explicit state ownership also applies to the verifier crates. +disallowed-macros = [ + { path = "std::thread_local", reason = "production state must be owned and passed explicitly; only test-local instrumentation may opt out" }, +] diff --git a/crates/lydite-celox/src/compiled.rs b/crates/lydite-celox/src/compiled.rs index 398d2bef714..4335d195d59 100644 --- a/crates/lydite-celox/src/compiled.rs +++ b/crates/lydite-celox/src/compiled.rs @@ -2,8 +2,8 @@ //! lifter and the Python conformance tools. Celox's own serde types carry the //! design and SIR; only the envelope around them is defined here. use celox_design::{ - ElaboratedDesign, InitialStateValue, RegionedStateAddr, RuntimeEventSite, StateAddr, - VariableMetadata, + DomainKind, ElaboratedDesign, InitialStateValue, RegionedStateAddr, RuntimeEventSite, + StateAddr, VariableMetadata, }; use celox_frontend_core::VariableKind; use celox_sir::{ExecutionUnit, SirProgram}; @@ -44,6 +44,13 @@ pub struct Design { pub state_objects: Vec, pub initial_state: Vec>, pub ordered_events: Vec, + /// Canonical edge kinds, including kinds carried by aliases of registers. + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub event_kinds: Vec<(StateAddr, DomainKind)>, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub derived_events: Vec<(StateAddr, Vec)>, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub combinational_derived: Vec<(StateAddr, Vec)>, pub cascaded_events: BTreeSet, pub event_aliases: Vec<(StateAddr, StateAddr)>, pub reset_clocks: Vec<(StateAddr, StateAddr)>, @@ -70,8 +77,22 @@ impl Compiled { } impl From> for Design { fn from(design: ElaboratedDesign) -> Self { + let mut event_kinds: Vec<_> = design.event_kinds().into_iter().collect(); + event_kinds.sort_by_key(|(address, _)| *address); let events = design.events; Self { + event_kinds, + derived_events: events.derived_events.into_iter().collect(), + combinational_derived: events + .combinational_derived + .into_iter() + .map(|(source, clocks)| { + ( + source, + clocks.into_iter().map(|clock| clock.clock).collect(), + ) + }) + .collect(), state_objects: design .state_objects .into_iter() diff --git a/crates/lydite-ir/clippy.toml b/crates/lydite-ir/clippy.toml index 5d4803ff5b1..0bede155ba9 100644 --- a/crates/lydite-ir/clippy.toml +++ b/crates/lydite-ir/clippy.toml @@ -1,2 +1,7 @@ # lydite is a standalone verifier CLI: Celox's simulator-library rules in the # workspace clippy.toml (no env reads, no eprintln, Fx hash maps) do not apply. + +# Explicit state ownership also applies to the verifier crates. +disallowed-macros = [ + { path = "std::thread_local", reason = "production state must be owned and passed explicitly; only test-local instrumentation may opt out" }, +] diff --git a/crates/lydite-solver/clippy.toml b/crates/lydite-solver/clippy.toml index 5d4803ff5b1..0bede155ba9 100644 --- a/crates/lydite-solver/clippy.toml +++ b/crates/lydite-solver/clippy.toml @@ -1,2 +1,7 @@ # lydite is a standalone verifier CLI: Celox's simulator-library rules in the # workspace clippy.toml (no env reads, no eprintln, Fx hash maps) do not apply. + +# Explicit state ownership also applies to the verifier crates. +disallowed-macros = [ + { path = "std::thread_local", reason = "production state must be owned and passed explicitly; only test-local instrumentation may opt out" }, +] diff --git a/crates/lydite-syntax/clippy.toml b/crates/lydite-syntax/clippy.toml index 5d4803ff5b1..0bede155ba9 100644 --- a/crates/lydite-syntax/clippy.toml +++ b/crates/lydite-syntax/clippy.toml @@ -1,2 +1,7 @@ # lydite is a standalone verifier CLI: Celox's simulator-library rules in the # workspace clippy.toml (no env reads, no eprintln, Fx hash maps) do not apply. + +# Explicit state ownership also applies to the verifier crates. +disallowed-macros = [ + { path = "std::thread_local", reason = "production state must be owned and passed explicitly; only test-local instrumentation may opt out" }, +] diff --git a/crates/lydite-verify/clippy.toml b/crates/lydite-verify/clippy.toml index 5d4803ff5b1..0bede155ba9 100644 --- a/crates/lydite-verify/clippy.toml +++ b/crates/lydite-verify/clippy.toml @@ -1,2 +1,7 @@ # lydite is a standalone verifier CLI: Celox's simulator-library rules in the # workspace clippy.toml (no env reads, no eprintln, Fx hash maps) do not apply. + +# Explicit state ownership also applies to the verifier crates. +disallowed-macros = [ + { path = "std::thread_local", reason = "production state must be owned and passed explicitly; only test-local instrumentation may opt out" }, +] diff --git a/crates/lydite/clippy.toml b/crates/lydite/clippy.toml index 5d4803ff5b1..0bede155ba9 100644 --- a/crates/lydite/clippy.toml +++ b/crates/lydite/clippy.toml @@ -1,2 +1,7 @@ # lydite is a standalone verifier CLI: Celox's simulator-library rules in the # workspace clippy.toml (no env reads, no eprintln, Fx hash maps) do not apply. + +# Explicit state ownership also applies to the verifier crates. +disallowed-macros = [ + { path = "std::thread_local", reason = "production state must be owned and passed explicitly; only test-local instrumentation may opt out" }, +] diff --git a/lydite/conformance/veryl-proof/README.md b/lydite/conformance/veryl-proof/README.md index 5dd90295067..5a5e80ed7ca 100644 --- a/lydite/conformance/veryl-proof/README.md +++ b/lydite/conformance/veryl-proof/README.md @@ -4,12 +4,12 @@ This job executes **every case of the in-tree reusable suite** (the Veryl suite of `crates/celox-test-suite`) with reads backed by finite proofs, compiled by the in-tree Celox frontend and the workspace Veryl. Its acceptance contract is the reviewed `coverage-manifest.json` plus `case-exceptions.json`: currently -**721 actual passes / 745** and 24 recorded exceptions. The raw test executable +**740 actual passes / 771** and 31 recorded exceptions. The raw test executable still exits 1 and reports the exceptions as failed. The coverage gate accepts each exception only with its exact recorded failure and design identities; it never changes an expectation into an expected compiler rejection. -The 721 passes comprise 710 observation-checked cases, three smoke-only cases and +The 740 passes comprise 729 observation-checked cases, three smoke-only cases and eight genuine expected compilation rejections. These are test-suite results, not a claim of unbounded equivalence, complete Veryl support, or verification of all possible stimuli. The independent narrow `../veryl` job is retained. @@ -68,6 +68,11 @@ run-status artifact. 5. Named `tick(event)` and lazy combinational evaluation implement the upstream Backend contract. Two-state storage starts at zero plus explicit initial writes; four-state logic starts unknown plus typed explicit initialization. + Derived event graphs and edge kinds come from typed elaboration. A clock + cycle settles both levels, evaluates coincident domains before publishing + their NBA updates, and follows further edges caused by those updates. + Clock payloads and masks are proved unique before selecting an edge; + four-state edges follow IEEE 1800-2023 Table 9-2, including async resets. General waveform timing outside the Backend's named-event API is not claimed. Display/Write/AssertContinue arguments are proved and logged; console delivery is outside this Backend API. Activated fatal events fail closed. @@ -109,11 +114,12 @@ and exact failure message: negative constant loop bounds (`InvalidForRange::NegativeBound`), and four call runtime `$clog2`/`$onehot` outside a function, which Veryl rejects as unsynthesizable (veryl-lang/veryl#2604). -- `unsupported_by_proof_backend`: twelve cases drive their design from a native +- `unsupported_by_proof_backend`: seventeen cases drive their design from a native Veryl testbench (`Backend::run_testbench`), which this backend does not run. -- `known_celox_failure`: five cases that the Celox frontend gets wrong today and - that Celox's own tests also ignore on every backend. Four of them depend on - logic declared inside an interface, which the Veryl analyzer IR drops. +- `known_celox_failure`: seven cases that Celox's own tests also ignore on its + native backends. Five depend on interface logic or nested instances that the + Veryl analyzer IR drops; the others cover instance arrays and direct function + calls on selected interface array elements. - `celox_unsupported`: one case whose design the Celox frontend refuses with a typed `Unsupported` error (generic interface ports, #1088). The bridge reports it as `frontend_unsupported`, which is neither a source rejection nor a diff --git a/lydite/conformance/veryl-proof/case-exceptions.json b/lydite/conformance/veryl-proof/case-exceptions.json index 1e4cba24355..2a9ef809988 100644 --- a/lydite/conformance/veryl-proof/case-exceptions.json +++ b/lydite/conformance/veryl-proof/case-exceptions.json @@ -84,6 +84,11 @@ "reason": "Logic declared inside an interface (assign/always_comb/always_ff) is missing from the Veryl analyzer IR, so the Celox frontend never evaluates it; Celox ignores this case on every backend (crates/celox/tests/interface.rs).", "panic": "interface::test_interface_always_ff_on_member_clock at 200:3: assert_eq count: expected 0x3, got 0x0" }, + "interface::test_interface_array_direct_function_calls": { + "kind": "known_celox_failure", + "reason": "Veryl 0.22 native IR loses the selected interface array element in function calls. Celox ignores this case on its native backends (crates/celox/tests/interface.rs); emitted SystemVerilog preserves the selection.", + "panic": "interface::test_interface_array_direct_function_calls at 1453:5: assert_eq y1: expected 0x8c, got 0x3c" + }, "interface::test_interface_continuous_assign_logic": { "kind": "known_celox_failure", "reason": "Logic declared inside an interface (assign/always_comb/always_ff) is missing from the Veryl analyzer IR, so the Celox frontend never evaluates it; Celox ignores this case on every backend (crates/celox/tests/interface.rs).", @@ -94,6 +99,11 @@ "reason": "Logic declared inside an interface (assign/always_comb/always_ff) is missing from the Veryl analyzer IR, so the Celox frontend never evaluates it; Celox ignores this case on every backend (crates/celox/tests/interface.rs).", "panic": "interface::test_interface_param_and_const at 1124:3: assert_eq f12: expected 0x1, got 0x0" }, + "interface::test_nested_interface_instance": { + "kind": "known_celox_failure", + "reason": "Veryl 0.22 native IR drops interface body assignments and nested instances. Celox ignores this case on its native backends (crates/celox/tests/interface.rs); emitted SystemVerilog retains them.", + "panic": "interface::test_nested_interface_instance at 1506:5: assert_eq y8: expected 0xcd, got 0x0" + }, "synth_dynamic_loop::test_constant_signed_bounds_in_unrolled_synth_loops": { "kind": "veryl_language_restriction", "reason": "Veryl rejects a negative constant for-range bound (InvalidForRange::NegativeBound).", @@ -118,5 +128,30 @@ "kind": "veryl_language_restriction", "reason": "Veryl rejects a runtime $clog2/$onehot argument outside a function as unsynthesizable (UnevaluableValue::SystemFunctionArg, veryl-lang/veryl#2604).", "panic": "compile system_function::test_direct_ff_onehot_system_function: analyzer-diagnostics:{\"detail\":\"[UnevaluableValue { kind: SystemFunctionArg(\\\"$onehot\\\"), input: MultiSources { sources: [Source { path: \\\"test.veryl\\\", text: \\\"\\\\nmodule Top (\\\\n clk: input clock,\\\\n d: input logic<8>,\\\\n q: output logic,\\\\n) {\\\\n always_ff (clk) {\\\\n q = $onehot(d);\\\\n }\\\\n}\\\\n\\\", line_offset: 0 }] }, error_location: SourceSpan { offset: SourceOffset(126), length: 1 }, token_source: File { path: PathId(0), text: TextId(1) }, instance: None }]\",\"diagnostics\":[{\"code\":\"UnevaluableValue\"}],\"stage\":\"analyzer\"}" + }, + "tb_string::array_elements": { + "kind": "unsupported_by_proof_backend", + "reason": "The proof backend has no native testbench execution (Backend::run_testbench); the case drives its design from a Veryl testbench.", + "panic": "run_testbench: this adapter does not support native testbench execution" + }, + "tb_string::assignment": { + "kind": "unsupported_by_proof_backend", + "reason": "The proof backend has no native testbench execution (Backend::run_testbench); the case drives its design from a Veryl testbench.", + "panic": "run_testbench: this adapter does not support native testbench execution" + }, + "tb_string::comparison": { + "kind": "unsupported_by_proof_backend", + "reason": "The proof backend has no native testbench execution (Backend::run_testbench); the case drives its design from a Veryl testbench.", + "panic": "run_testbench: this adapter does not support native testbench execution" + }, + "tb_string::control_flow": { + "kind": "unsupported_by_proof_backend", + "reason": "The proof backend has no native testbench execution (Backend::run_testbench); the case drives its design from a Veryl testbench.", + "panic": "run_testbench: this adapter does not support native testbench execution" + }, + "tb_string::function_argument": { + "kind": "unsupported_by_proof_backend", + "reason": "The proof backend has no native testbench execution (Backend::run_testbench); the case drives its design from a Veryl testbench.", + "panic": "run_testbench: this adapter does not support native testbench execution" } } diff --git a/lydite/conformance/veryl-proof/coverage-manifest.json b/lydite/conformance/veryl-proof/coverage-manifest.json index f56767a349c..6790193a8eb 100644 --- a/lydite/conformance/veryl-proof/coverage-manifest.json +++ b/lydite/conformance/veryl-proof/coverage-manifest.json @@ -3453,6 +3453,26 @@ } ] }, + { + "case": "flip_flop::test_ff_divider_of_a_divider", + "expectation": "Simulation", + "category": "Sequential", + "source": { + "file": "src/veryl/cases/flip_flop.vtest", + "script_sha256": "ef04c26afe2980b73d986b6d86bb0fe5f3245e05bbebf083f22b6edbc4e0d25c" + }, + "disposition": "observation_verified", + "designs": [ + { + "design_sha256": "e0a8670509f6e02d4397e42811df31f2217771daf8cd809081527a821881d649", + "protocol_sha256": "c483944c7eaad31e6a876218ac267c02868d41baaba214d3f6e37d1998cc25b1", + "reads": 12, + "commands": 31, + "operations": 63, + "diagnostic": null + } + ] + }, { "case": "flip_flop::test_ff_dynamic_nonlocal_store_follows_pending_whole_write", "expectation": "Simulation", @@ -4593,6 +4613,46 @@ } ] }, + { + "case": "flip_flop::test_ff_gated_clock_follows_its_enable", + "expectation": "Simulation", + "category": "Sequential", + "source": { + "file": "src/veryl/cases/flip_flop.vtest", + "script_sha256": "3e166ed29e74cec524823dc59b0a35e74b44c90083b33e50305022bc9fdeb5bc" + }, + "disposition": "observation_verified", + "designs": [ + { + "design_sha256": "0b95552042af7880fbad5f55fa3c80c35e11ab79930094f3e171402fb696c42c", + "protocol_sha256": "fde4d0822d550b396b1838b97e14c5289fe291f79a0412aa0246c8e312435c20", + "reads": 16, + "commands": 48, + "operations": 46, + "diagnostic": null + } + ] + }, + { + "case": "flip_flop::test_ff_gated_clock_samples_pre_edge_state", + "expectation": "Simulation", + "category": "Sequential", + "source": { + "file": "src/veryl/cases/flip_flop.vtest", + "script_sha256": "14e5b42fa830b415e90c6d93043d57e999f58773947dfcba03d746405dd3a825" + }, + "disposition": "observation_verified", + "designs": [ + { + "design_sha256": "77b093f21df8fb7bb2d40821f8771e3e512696131a25717998e6cdd58d9e5a3d", + "protocol_sha256": "f7872a75641b9bebc801a510bac39ab141f91c40dc82f12f1d57674b7b3c1649", + "reads": 12, + "commands": 38, + "operations": 36, + "diagnostic": null + } + ] + }, { "case": "flip_flop::test_ff_i32_bitwise_steps_discard_bits_above_the_counter_width", "expectation": "Simulation", @@ -4673,6 +4733,26 @@ } ] }, + { + "case": "flip_flop::test_ff_inverted_clock_samples_after_the_rising_edge", + "expectation": "Simulation", + "category": "Sequential", + "source": { + "file": "src/veryl/cases/flip_flop.vtest", + "script_sha256": "00050d57a4f71d753f475fe9252aa6d75fffb28d6a5467e279df10c1143325f3" + }, + "disposition": "observation_verified", + "designs": [ + { + "design_sha256": "de948d37952bf67e11a4faaa6c93f1655b11355d1ba48fa4a059aaa502094fa3", + "protocol_sha256": "f316626b86f156f30060fb3c7134c95cc16cf47f3eaf54985c7afe3c848d40bc", + "reads": 10, + "commands": 22, + "operations": 32, + "diagnostic": null + } + ] + }, { "case": "flip_flop::test_ff_nested_function_call_expression", "expectation": "Simulation", @@ -4873,6 +4953,86 @@ } ] }, + { + "case": "flip_flop::test_ff_register_bit_clock_follows_the_selected_bit", + "expectation": "Simulation", + "category": "Sequential", + "source": { + "file": "src/veryl/cases/flip_flop.vtest", + "script_sha256": "cafd48f2992292dca19764407bb22fb0c18cbddc845d50fc7db8d1649be85b21" + }, + "disposition": "observation_verified", + "designs": [ + { + "design_sha256": "cc054e9e02085a59ae3f6e85607c43a0267acff643bbff031ecd374fbc564be2", + "protocol_sha256": "1233385b5d72ff181356f530415630860949c07e32d5bf3842035cec5c130292", + "reads": 36, + "commands": 55, + "operations": 63, + "diagnostic": null + } + ] + }, + { + "case": "flip_flop::test_ff_register_bit_clock_ignores_other_bits", + "expectation": "Simulation", + "category": "Sequential", + "source": { + "file": "src/veryl/cases/flip_flop.vtest", + "script_sha256": "88a67b1bb53ca90d0da6d93019ee29057a1b4aefbf3a3e3a3d112fef13517eef" + }, + "disposition": "observation_verified", + "designs": [ + { + "design_sha256": "94499a66b9f41125ec17a9b3b45999cd3c5c21acc7c71407da915f3cdef699aa", + "protocol_sha256": "f609d4dd396f84344d91a0b87a9b361e421e480f6e5ec5c9266de58a36764253", + "reads": 12, + "commands": 25, + "operations": 30, + "diagnostic": null + } + ] + }, + { + "case": "flip_flop::test_ff_register_gated_clock_rises_after_the_commit", + "expectation": "Simulation", + "category": "Sequential", + "source": { + "file": "src/veryl/cases/flip_flop.vtest", + "script_sha256": "f6e02bc42c6eaa4a900627121073ea44ac04f5026150f1c00087e97cdec0c1f9" + }, + "disposition": "observation_verified", + "designs": [ + { + "design_sha256": "664d38b99327916aaa7da681b8a4fbc4b09321b08fe1f657cb951c86d1ce2065", + "protocol_sha256": "e88a5cf1b2fd864d56058a9490f49e10c8e228f54f96149b0558f115855021bf", + "reads": 24, + "commands": 56, + "operations": 49, + "diagnostic": null + } + ] + }, + { + "case": "flip_flop::test_ff_register_gated_clock_uses_the_pre_edge_enable", + "expectation": "Simulation", + "category": "Sequential", + "source": { + "file": "src/veryl/cases/flip_flop.vtest", + "script_sha256": "e77f0851345122d123a387a16a6e0f04e31fed66fa24e8a41ba64bf92d43b924" + }, + "disposition": "observation_verified", + "designs": [ + { + "design_sha256": "664d38b99327916aaa7da681b8a4fbc4b09321b08fe1f657cb951c86d1ce2065", + "protocol_sha256": "7d4a742a24aff49431d9fea22846f40601d088122e9cca43eb9cfe9c7e1bbd58", + "reads": 15, + "commands": 38, + "operations": 32, + "diagnostic": null + } + ] + }, { "case": "flip_flop::test_ff_runtime_for_bitwise_steps", "expectation": "Simulation", @@ -5653,6 +5813,26 @@ } ] }, + { + "case": "four_state::test_four_state_comb_clock_edges_follow_table_9_2", + "expectation": "Simulation", + "category": "FourState", + "source": { + "file": "src/veryl/cases/four_state.vtest", + "script_sha256": "036c53b50126e8837ad30daeab9d4eb78a3d3417e68aaf40f72db3c733ebe658" + }, + "disposition": "observation_verified", + "designs": [ + { + "design_sha256": "44598e96391cea70f4927c037ddeecf524be1fc9b6fb329bfd494a7a22f50320", + "protocol_sha256": "d150b1333004b7141be5accd2d05e95a21bfa23c60aac67ccf9cbfc2f0e2b7f3", + "reads": 26, + "commands": 58, + "operations": 78, + "diagnostic": null + } + ] + }, { "case": "four_state::test_four_state_comparison_with_x", "expectation": "Simulation", @@ -5953,6 +6133,26 @@ } ] }, + { + "case": "four_state::test_four_state_internal_async_reset_edges_follow_table_9_2", + "expectation": "Simulation", + "category": "FourState", + "source": { + "file": "src/veryl/cases/four_state.vtest", + "script_sha256": "7e926976720d0f3329d973c1230fa57f05684c6f17f88753772fd44867e214e4" + }, + "disposition": "observation_verified", + "designs": [ + { + "design_sha256": "6788223509cf0cf16fe9ad30241dbf343490814fd0fd44ce820cf9773fbde40f", + "protocol_sha256": "91ab055bbde7b8f1dcf8232c330758104d715efb38e23572c303f71610deb2fa", + "reads": 26, + "commands": 72, + "operations": 73, + "diagnostic": null + } + ] + }, { "case": "four_state::test_four_state_logic_and_dominant_zero", "expectation": "Simulation", @@ -6333,6 +6533,26 @@ } ] }, + { + "case": "four_state::test_four_state_register_clock_edges_follow_table_9_2", + "expectation": "Simulation", + "category": "FourState", + "source": { + "file": "src/veryl/cases/four_state.vtest", + "script_sha256": "4ac195c74ecbbcbcbc098c9d9ad01df53e60506d3c3229abfd9538b97d6bf798" + }, + "disposition": "observation_verified", + "designs": [ + { + "design_sha256": "f302c7c7b7cedd69f36be239c09c05e50572b4f6c79515c4b737003dbfab0803", + "protocol_sha256": "36c2e6af2f98e801da84675898e840f31cb2aad14babe0609798017ea10cfb23", + "reads": 28, + "commands": 60, + "operations": 79, + "diagnostic": null + } + ] + }, { "case": "four_state::test_four_state_sar_both_x", "expectation": "Simulation", @@ -8463,6 +8683,26 @@ } ] }, + { + "case": "interface::test_interface_array_direct_function_calls", + "expectation": "Simulation", + "category": "Hierarchy", + "source": { + "file": "src/veryl/cases/interface.vtest", + "script_sha256": "fda075fc1370158f96c09289bb18198c72019e40f6da9e9662fabde57bcc4e1d" + }, + "disposition": "known_celox_failure", + "designs": [ + { + "design_sha256": "cc399b9a0c2bcef8c84110da907dfbdb4c99139575cbfe1df3c551f1340fc1aa", + "protocol_sha256": "8a94a565a601c63c429cb7ee8feb63aebcd06b430abeb4ca0f4eb5a4f20af515", + "reads": 4, + "commands": 10, + "operations": 2, + "diagnostic": null + } + ] + }, { "case": "interface::test_interface_connect_modport_to_constant", "expectation": "Simulation", @@ -8703,6 +8943,26 @@ } ] }, + { + "case": "interface::test_interface_type_parameter", + "expectation": "Simulation", + "category": "Hierarchy", + "source": { + "file": "src/veryl/cases/interface.vtest", + "script_sha256": "0d741f926f097f552b68283001d622459f449e1b415fabfca1eff0d6ebf1f2d1" + }, + "disposition": "observation_verified", + "designs": [ + { + "design_sha256": "9e81a1646225e14aa5009ef8fcddb57eb4ccfc18512c65eeb7fa9ffdd9d848b0", + "protocol_sha256": "34b6c497793dee08d9730e4300521b69cad55f3c556dd75c2110f0ec61855686", + "reads": 2, + "commands": 6, + "operations": 1, + "diagnostic": null + } + ] + }, { "case": "interface::test_interface_valid_ready_handshake", "expectation": "Simulation", @@ -8903,6 +9163,46 @@ } ] }, + { + "case": "interface::test_nested_interface_instance", + "expectation": "Simulation", + "category": "Hierarchy", + "source": { + "file": "src/veryl/cases/interface.vtest", + "script_sha256": "1f0a520f9b8c25a135c2ac49000a79a97429d33a5377a02e1872454e96cc8395" + }, + "disposition": "known_celox_failure", + "designs": [ + { + "design_sha256": "99b1f819ac093ba31afbfdca8f6fcaa5152c4eef434bd35c2280e414c1c28083", + "protocol_sha256": "79d32898c4015e0d5d093658fb84b8d41583804d72fca943bd741c5ae96d79f4", + "reads": 3, + "commands": 9, + "operations": 2, + "diagnostic": null + } + ] + }, + { + "case": "interface::test_parameterized_interface_header_imports", + "expectation": "Simulation", + "category": "Hierarchy", + "source": { + "file": "src/veryl/cases/interface.vtest", + "script_sha256": "78f7e73e906c67561bbe0b9bcb1da89aab3df3fde0b3eec9d6d08c68090d8024" + }, + "disposition": "observation_verified", + "designs": [ + { + "design_sha256": "de03d433e136149732b3d7c31e0be5527fe2528ab1887e5742dac8328b51d850", + "protocol_sha256": "745e63e856404dcbc219347daaa80b57b41e38aee6fdcfcc222b6fb076debf18", + "reads": 6, + "commands": 14, + "operations": 3, + "diagnostic": null + } + ] + }, { "case": "interface::test_proto_interface_generic_module", "expectation": "Simulation", @@ -9023,6 +9323,86 @@ } ] }, + { + "case": "logical_shift_count::four_state_dynamic_counts", + "expectation": "Simulation", + "category": "Operators", + "source": { + "file": "src/veryl/cases/logical_shift_count.vtest", + "script_sha256": "14ca654d4c7a1a1fad017b70ece072f44c1998eb7ac50374d7c1168301d4f09b" + }, + "disposition": "observation_verified", + "designs": [ + { + "design_sha256": "4e0bba213129272bd1462b3456909b91c443a9ec354deb414809b9cdca198bb8", + "protocol_sha256": "0ae824b89084c41fcfc6aae0bb901f678a6df9a5dead08fb9eb11bad9bf84450", + "reads": 104, + "commands": 137, + "operations": 14, + "diagnostic": null + } + ] + }, + { + "case": "logical_shift_count::two_state_dynamic_counts", + "expectation": "Simulation", + "category": "Operators", + "source": { + "file": "src/veryl/cases/logical_shift_count.vtest", + "script_sha256": "14335d3d95f81cc574b4c5c3b3331e2125778655cb417e1d8891c56568520109" + }, + "disposition": "observation_verified", + "designs": [ + { + "design_sha256": "b562bd1a193a931c2b109a4768cabb0e2662994aff5eae30a23c8544aed27362", + "protocol_sha256": "752c04e204b368563af65a548fca5cc9eeb3fee2d1c89c297b9b858bf7c66415", + "reads": 112, + "commands": 147, + "operations": 15, + "diagnostic": null + } + ] + }, + { + "case": "logical_shift_count::two_state_single_bit_wrap", + "expectation": "Simulation", + "category": "Operators", + "source": { + "file": "src/veryl/cases/logical_shift_count.vtest", + "script_sha256": "e9b6993aec6663f3dee9b03ee47285f2d6904b4884d64f2e21c987b472d5a790" + }, + "disposition": "observation_verified", + "designs": [ + { + "design_sha256": "332938613ba68caf86ccc02cf61114e0ca00afca46ba1ab1d9dec22c6c69fbae", + "protocol_sha256": "f914cc18bd97f18912ca4cde043ebd7677b694b7ffaf7aea6e17c5601e579ff4", + "reads": 40, + "commands": 61, + "operations": 6, + "diagnostic": null + } + ] + }, + { + "case": "logical_shift_count::two_state_wide_count", + "expectation": "Simulation", + "category": "Operators", + "source": { + "file": "src/veryl/cases/logical_shift_count.vtest", + "script_sha256": "4601a97de98c5aec35905a0cab91d0fbf796e796d19fcffab32cdda5a5671d3e" + }, + "disposition": "observation_verified", + "designs": [ + { + "design_sha256": "3c29476f29f1c8cd3a66ce69b95100da225232833f116968ace5611fd2a9dbac", + "protocol_sha256": "57539e492802c217895e1d5af2fe079d94926c9148c434c382e635d3ff5f9a41", + "reads": 20, + "commands": 35, + "operations": 6, + "diagnostic": null + } + ] + }, { "case": "loop_idiom::test_guarded_packed_scan", "expectation": "Simulation", @@ -10343,6 +10723,26 @@ } ] }, + { + "case": "param_override::test_four_state_integral_instance_override", + "expectation": "Simulation", + "category": "Types", + "source": { + "file": "src/veryl/cases/param_override.vtest", + "script_sha256": "baac6579e54d7343d86951993da8fc5af074f7b88baeb9e3869f0213399ee744" + }, + "disposition": "observation_verified", + "designs": [ + { + "design_sha256": "627f78d3ba13ca8042f441278a632b0553d8d8ccfc24937829068e0b0d000c3c", + "protocol_sha256": "3edbe615eef3984f57d0e32e7212333522f28572b9c4656fa7200492a2af848e", + "reads": 1, + "commands": 3, + "operations": 1, + "diagnostic": null + } + ] + }, { "case": "param_override::test_param_const_fold_if", "expectation": "Simulation", @@ -10503,6 +10903,26 @@ } ] }, + { + "case": "param_override::test_wide_integral_instance_override", + "expectation": "Simulation", + "category": "Types", + "source": { + "file": "src/veryl/cases/param_override.vtest", + "script_sha256": "0a02ded531384245c1dbf6d8bd7528a70d2de75c42112dbab798356120bfbb71" + }, + "disposition": "observation_verified", + "designs": [ + { + "design_sha256": "728b89d760fc214be05eae45219b26dcf5aaffe76e4f867b571308e54724f238", + "protocol_sha256": "2148359c9b04b8bc14699b672b561c1ab9b473629afa0c59cd22335fc3888afe", + "reads": 2, + "commands": 4, + "operations": 1, + "diagnostic": null + } + ] + }, { "case": "partial_word_shift::four_state_matrix", "expectation": "Simulation", @@ -13143,6 +13563,106 @@ } ] }, + { + "case": "tb_string::array_elements", + "expectation": "Simulation", + "category": "ControlFlow", + "source": { + "file": "src/veryl/cases/tb_string.vtest", + "script_sha256": "cf2743004c5ad7ee0f4161aebe321048f39b19db8075956384eb86d27e60fff3" + }, + "disposition": "unsupported_by_proof_backend", + "designs": [ + { + "design_sha256": "7109bbb56d6c5e1516568da6e5dad7c468dd13dd83c6e739f541159fdce129a8", + "protocol_sha256": "68552b988f6de856544b57423adb8fcc513805948b917e71fb9a172e11bd9e84", + "reads": 0, + "commands": 2, + "operations": 0, + "diagnostic": null + } + ] + }, + { + "case": "tb_string::assignment", + "expectation": "Simulation", + "category": "ControlFlow", + "source": { + "file": "src/veryl/cases/tb_string.vtest", + "script_sha256": "a9d0e554ded364580419bb3daaf1582f956071a7f3c59e6f4c50efea2009fab7" + }, + "disposition": "unsupported_by_proof_backend", + "designs": [ + { + "design_sha256": "4e385c769101533ac23f7a18316102cc60a5584fde4b6c6b8be2929ee0f74828", + "protocol_sha256": "ea385b15d2e7003c6c792cf15831dbe6ae8adfabf33ae16c894e67c675326771", + "reads": 0, + "commands": 2, + "operations": 0, + "diagnostic": null + } + ] + }, + { + "case": "tb_string::comparison", + "expectation": "Simulation", + "category": "ControlFlow", + "source": { + "file": "src/veryl/cases/tb_string.vtest", + "script_sha256": "a1cde08f77956687495843855803ba3421fbaf36fe01d34617c64c6b0f9ab40d" + }, + "disposition": "unsupported_by_proof_backend", + "designs": [ + { + "design_sha256": "338374b857c99f6d0a9e5751ee8de1b2d9fd1fe89ac3498e8b225b3d3b391a76", + "protocol_sha256": "680aa3d4a0798f3a0514bca3ddcee9a5ecf2b31160d7cdecbd5587900e8cb10f", + "reads": 0, + "commands": 2, + "operations": 0, + "diagnostic": null + } + ] + }, + { + "case": "tb_string::control_flow", + "expectation": "Simulation", + "category": "ControlFlow", + "source": { + "file": "src/veryl/cases/tb_string.vtest", + "script_sha256": "e8f482a505ee2079289a1ca6903bd94c2b3352cd4036c904918b6ee0da6f4d0e" + }, + "disposition": "unsupported_by_proof_backend", + "designs": [ + { + "design_sha256": "c2a01298c8e1451c375315cad86334afb1b0dccafa15fac9c1b17adb934fc58a", + "protocol_sha256": "1028b966bb10a115a10699d10dea071cdf9e3fc01c52023d700444c294e3c215", + "reads": 0, + "commands": 2, + "operations": 0, + "diagnostic": null + } + ] + }, + { + "case": "tb_string::function_argument", + "expectation": "Simulation", + "category": "ControlFlow", + "source": { + "file": "src/veryl/cases/tb_string.vtest", + "script_sha256": "7c10db76d6e762db57b0396049e7a513f1ec1c65c4a4909ac71049c426fce2c9" + }, + "disposition": "unsupported_by_proof_backend", + "designs": [ + { + "design_sha256": "0e06850d0cc0a99493cd7207f749f5747e931e029f088fcf919438f2591bf033", + "protocol_sha256": "ab8bd6fa9ac482e734a5dae6118c9293ec8181d8736dc10968a6e3238d65dfd9", + "reads": 0, + "commands": 2, + "operations": 0, + "diagnostic": null + } + ] + }, { "case": "test_unimplemented_paths::dynamic_mask_store", "expectation": "Simulation", diff --git a/lydite/conformance/veryl-proof/proof_backend.py b/lydite/conformance/veryl-proof/proof_backend.py index 44e0b60025e..436f6b1c4eb 100644 --- a/lydite/conformance/veryl-proof/proof_backend.py +++ b/lydite/conformance/veryl-proof/proof_backend.py @@ -184,6 +184,7 @@ class Backend: def __init__(self,compiled,four_state,out): if four_state:raise Unsupported('four-state encoding not implemented in this scalar vertical slice') compiled=normalize_compiled(compiled) + self.four_state=False self.code=compiled;self.state={};self.meta={};self.sparse={};self.dirty=True;self.operations=0;self.event_log=[];self.div_cache={};self.div_events=[] self.signals={} for signal in compiled['signals']: @@ -200,6 +201,11 @@ def __init__(self,compiled,four_state,out): self.proof=Proof(out) self.events={address(x['event']):x['units'] for x in compiled['sir']['eval_apply_ffs']} self.aliases={address(a):address(b) for a,b in compiled['design']['event_aliases']} + self.event_kinds={address(a):kind for a,kind in compiled['design'].get('event_kinds',[])} + self.derived={address(a):[address(b) for b in targets] for a,targets in compiled['design'].get('derived_events',[])} + self.combinational={address(a):[address(b) for b in targets] for a,targets in compiled['design'].get('combinational_derived',[])} + self.eval_only={address(x['event']):x['units'] for x in compiled['sir']['eval_only_ffs']} + self.apply={address(x['event']):x['units'] for x in compiled['sir']['apply_ffs']} def close(self): self.proof.close();(self.proof.out/'nonfatal-events.json').write_text(json.dumps(self.event_log,indent=2)+'\n') (self.proof.out/'division-reuse.json').write_text(json.dumps(self.div_events,indent=2)+'\n') @@ -222,8 +228,57 @@ def tick(self,name): if self.dirty:self.eval_comb() key=address(self.signal(name)['address']);key=self.aliases.get(key,key) if key not in self.events:raise Unsupported('event has no eval/apply SIR '+name) - for unit in self.events[key]:self.execute(unit) - self.eval_comb() + if self.derived.get(key) or self.combinational.get(key): + self.tick_derived(key) + else: + for unit in self.events[key]:self.execute(unit) + self.eval_comb() + def event_level(self,key): + payload=self.proof.unique(self.load(key,0,1),'clock payload') + mask=self.proof.unique(self.load_mask(key,0,1),'clock mask') if self.four_state else 0 + return payload|(mask<<1) + def event_edge(self,key,before,after): + kind=self.event_kinds[key] + if kind in ('ClockPosedge','ResetAsyncHigh'): + return before!=after and (before==0 or after==1) + if kind in ('ClockNegedge','ResetAsyncLow'): + return before!=after and (before==1 or after==0) + raise Unsupported('derived clock has no edge kind: '+str(kind)) + def tick_derived(self,key): + # IEEE 1800-2023 4.5: evaluate coincident edges before publishing + # their NBA updates; publication may create another wave of edges. + watched={key};pending=[key] + while pending: + source=pending.pop() + for target in self.derived.get(source,[])+self.combinational.get(source,[]): + if target not in watched:watched.add(target);pending.append(target) + ordered=[address(a) for a in self.code['design']['ordered_events'] if address(a) in watched] + if set(ordered)!=watched: + raise Unsupported('derived clock missing from ordered events') + if any(event not in self.event_kinds for event in watched): + raise Unsupported('derived clock lacks typed edge metadata') + def levels():return {event:self.event_level(event) for event in ordered} + def settle(before): + self.eval_comb();after=levels() + return [event for event in ordered if self.event_edge(event,before[event],after[event])] + def drain(events): + for _ in range(10000): + if not events:return + before=levels() + for event in events: + if event not in self.eval_only or event not in self.apply: + raise Unsupported('derived clock lacks split eval/apply SIR') + for unit in self.eval_only[event]:self.execute(unit) + for event in events: + for unit in self.apply[event]:self.execute(unit) + events=settle(before) + raise Unsupported('derived-clock settling budget exceeded') + def drive(value): + before=levels();self.store(key,0,1,self.proof.bind(const(1,value))) + if self.four_state:self.store_mask(key,0,1,const(1,0)) + drain(settle(before)) + active=0 if self.event_kinds[key] in ('ClockNegedge','ResetAsyncLow') else 1 + drive(1-active);drive(active);drive(1-active) def load(self,key,offset,width): if key[2]==2:raise Unsupported('sparse next-state region cannot be loaded') if key not in self.state: diff --git a/lydite/conformance/veryl-proof/tests/test_events.py b/lydite/conformance/veryl-proof/tests/test_events.py new file mode 100644 index 00000000000..4176447ee20 --- /dev/null +++ b/lydite/conformance/veryl-proof/tests/test_events.py @@ -0,0 +1,28 @@ +import unittest +from proof_backend import Backend, Unsupported + + +class EventTests(unittest.TestCase): + def test_four_state_edge_table(self): + # Payload/mask levels: 0, 1, Z=2, X=3. IEEE 1800 Table 9-2. + rising = {(0, 1), (0, 2), (0, 3), (2, 1), (3, 1)} + falling = {(1, 0), (1, 2), (1, 3), (2, 0), (3, 0)} + backend = Backend.__new__(Backend) + for kind, expected in [('ClockPosedge', rising), ('ResetAsyncHigh', rising), + ('ClockNegedge', falling), ('ResetAsyncLow', falling)]: + backend.event_kinds = {'event': kind} + for before in range(4): + for after in range(4): + with self.subTest(kind=kind, before=before, after=after): + self.assertEqual(backend.event_edge('event', before, after), + (before, after) in expected) + + def test_untyped_event_fails_closed(self): + backend = Backend.__new__(Backend) + backend.event_kinds = {'event': 'Other'} + with self.assertRaisesRegex(Unsupported, 'no edge kind'): + backend.event_edge('event', 0, 1) + + +if __name__ == '__main__': + unittest.main() diff --git a/scripts/ci-workflow.test.mjs b/scripts/ci-workflow.test.mjs index 5f9224a94e8..01dcfd5452d 100644 --- a/scripts/ci-workflow.test.mjs +++ b/scripts/ci-workflow.test.mjs @@ -457,3 +457,7 @@ test("cocotb retains Celox features without enabling unrelated adapter features" "cocotb_drives_an_attached_native_flip_flop", "--", "--exact", "--ignored"]); assert.match(job("rust-tests"), /name: Run cocotb VPI end-to-end test\n if: needs.changes.outputs.rust_vpi_e2e != 'false'/); }); + +test("full Clippy validation covers every workspace crate", () => { + assert.match(job("lint"), /run: cargo clippy --locked --workspace --all-targets --features/); +});