pub fn check_connected(uut: &dyn Block) -> Result<(), CheckError>
Expand description

Check to see if a circuit is properly connected (no undriven inputs, or multiply-driven outputs). You can call this directly on a circuit of yours if you want to check that it is correctly connected internally.

use rust_hdl_core::prelude::*;

#[derive(LogicBlock, Default)]
struct Broken {
    pub I: Signal<In, Bit>,
    pub O: Signal<Out, Bit>,
}

impl Logic for Broken {
   #[hdl_gen]
   fn update(&mut self) {
      // Purposely left blank... circuit is broken!
   }
}

let mut uut = TopWrap::new(Broken::default()); // <- we use TopWrap since we want Broken to not be the top
uut.connect_all();
assert!(check_connected(&uut).is_err())