dont_touch/
dont_touch.rs

1use safety_net::{Gate, Netlist, dont_touch_filter};
2
3fn and_gate() -> Gate {
4    Gate::new_logical("AND".into(), vec!["A".into(), "B".into()], "Y".into())
5}
6
7fn main() {
8    let netlist = Netlist::new("example".to_string());
9
10    // Add the the two inputs
11    let a = netlist.insert_input("a".into());
12    let b = netlist.insert_input("b".into());
13
14    // Instantiate an AND gate
15    let instance = netlist
16        .insert_gate(and_gate(), "inst_0".into(), &[a, b])
17        .unwrap();
18
19    // Make this AND gate an output
20    instance.set_attribute("dont_touch".to_string());
21    instance.expose_with_name("y".into());
22
23    for nr in dont_touch_filter(&netlist) {
24        println!("Don't touch: {nr}");
25    }
26}