pub mod aig;
pub mod generic_network;
pub mod klut;
pub mod mig;
pub enum SimplifyResult<Node, NodeId> {
Node(Node, bool),
Simplified(NodeId, bool),
}
impl<N, Id> SimplifyResult<N, Id> {
pub fn and_then(self, f: impl Fn(N) -> SimplifyResult<N, Id>) -> SimplifyResult<N, Id> {
match self {
Self::Node(n, invert) => f(n).invert_conditional(invert), _ => self, }
}
pub fn map_unsimplified(self, f: impl Fn(N) -> N) -> SimplifyResult<N, Id> {
match self {
Self::Node(n, invert) => Self::Node(f(n), invert),
_ => self,
}
}
pub fn new_node(node: N) -> Self {
Self::Node(node, false)
}
pub fn new_id(id: Id) -> Self {
Self::Simplified(id, false)
}
pub fn invert_conditional(self, invert: bool) -> Self {
match self {
SimplifyResult::Node(n, i) => Self::Node(n, i ^ invert),
SimplifyResult::Simplified(n, i) => Self::Simplified(n, i ^ invert),
}
}
}