Skip to main content

bitloom_sim/
shared_stimulus.rs

1//! FR92 shared-stimulus scoreboard skeleton.
2//!
3//! One stimulus vector drives both the functional-sim path and cycle-accurate
4//! `tick` (via [`crate::check_functional_equiv_generated`]). This is **not**
5//! sufficient alone to close FR100 — see [`crate::FormalEquivProduct`] and
6//! `docs/fr100-formal-equiv.md`. SystemC TLM-2.0 remains Epic 46 / FR101 (AD-5).
7//!
8//! Bridge adapter template for transaction→cycle handshakes remains
9//! `bitloom_prelude::{StartWaitComplete, start_wait_complete}` (FR78).
10
11use bitloom_hir::{FrozenHir, PortValues};
12
13use crate::{EquivStatus, check_functional_equiv_generated, reset_then_run};
14
15/// Shared stimulus / scoreboard fixture for multi-view co-check (FR92).
16///
17/// Hold a single `Vec<PortValues>` and run it through the generated functional
18/// path vs `Sim::tick`. Expected outputs are the PortValues produced by both
19/// sides under the same inputs (contrast / scoreboard), not a separate oracle
20/// language.
21#[derive(Debug, Clone)]
22pub struct SharedStimulusScoreboard {
23    /// Stimulus frames shared by functional and cycle-accurate paths.
24    pub stimuli: Vec<PortValues>,
25}
26
27impl SharedStimulusScoreboard {
28    /// Build from an explicit shared stimulus vector.
29    pub fn from_stimuli(stimuli: Vec<PortValues>) -> Self {
30        Self { stimuli }
31    }
32
33    /// Convenience: reset-high one cycle, then `n` cycles with `rst=0`.
34    pub fn from_reset_then_run(n: usize) -> Self {
35        Self::from_stimuli(reset_then_run(n))
36    }
37
38    /// Drive the **same** stimuli through FR47 generated functional vs `tick`.
39    pub fn check_generated(&self, hir: FrozenHir) -> EquivStatus {
40        check_functional_equiv_generated(hir, self.stimuli.clone())
41    }
42}