libreda_sta/traits/
delay_base.rs

1// Copyright (c) 2021-2021 Thomas Kramer.
2// SPDX-FileCopyrightText: 2022 Thomas Kramer <code@tkramer.ch>
3//
4// SPDX-License-Identifier: AGPL-3.0-or-later
5
6//! Abstraction of the delay computation.
7
8use num_traits::Zero;
9
10use super::timing_base::TimingBase;
11
12use blanket::blanket;
13
14/// Abstraction of a delay model.
15#[blanket(derive(Ref))]
16pub trait DelayBase: TimingBase {
17    /// Type representing a delay.
18    /// This can be as simple as a `f64` or more complicated such as a probability distribution.
19    type Delay: Clone + std::fmt::Debug + Zero + Send + Sync;
20
21    /// Summarize multiple possible output signals into one signal.
22    /// Depending on the timing analysis mode (late/early) this might be
23    /// a `max` or `min` function.
24    // TODO: Rename to 'summarize_signals'
25    fn summarize_delays(&self, signal1: &Self::Signal, signal2: &Self::Signal) -> Self::Signal;
26
27    /// Compute the delay from one signal to another signal.
28    fn get_delay(&self, from: &Self::Signal, to: &Self::Signal) -> Self::Delay;
29}