Skip to main content

fic/ccfg/
system.rs

1//! The project's graphs: one [`Orchestration`] per program, by the
2//! program's id. Declarations are not copied here: a label or guard names
3//! them by `tast`'s ids, and a backend reads them from `tast`.
4
5use serde::Serialize;
6
7use crate::base::{ChanId, IdVec, PdId};
8
9use super::graph::Ccfg;
10use super::message::Message;
11use super::ring::Ring;
12
13/// Every program's graphs.
14#[derive(Debug, Clone, Serialize)]
15pub struct System {
16    /// One per program, as `tast`'s `programs`: every program binds both
17    /// mandatory entry points.
18    pub programs: IdVec<PdId, Orchestration>,
19    /// Each channel's ring, by the channel's id; `None` for an unbuffered
20    /// channel.
21    pub rings: IdVec<ChanId, Option<Ring>>,
22    /// Each channel's message, by the channel's id; `None` unless it is a
23    /// `Sync Chan<T>`.
24    pub messages: IdVec<ChanId, Option<Message>>,
25}
26
27/// One protection domain's behaviour: one graph per bound Microkit entry
28/// point.
29#[derive(Debug, Clone, Serialize)]
30pub struct Orchestration {
31    /// `microkit.init`'s graph.
32    pub init: Ccfg,
33    /// `microkit.notified`'s graph.
34    pub notified: Ccfg,
35    /// `microkit.protected`'s graph, if the program binds it.
36    pub protected: Option<Ccfg>,
37}