rust_hdl_core/
top_wrap.rs

1use crate::{ast::Verilog, block::Block, logic::Logic, probe::Probe, timing::TimingInfo};
2
3pub struct TopWrap<U: Block> {
4    pub uut: U,
5}
6
7impl<U: Block> TopWrap<U> {
8    pub fn new(uut: U) -> Self {
9        Self { uut }
10    }
11}
12
13impl<U: Block> Logic for TopWrap<U> {
14    fn update(&mut self) {}
15}
16
17impl<U: Block> Block for TopWrap<U> {
18    fn connect_all(&mut self) {
19        self.connect();
20        self.uut.connect_all();
21    }
22    fn update_all(&mut self) {
23        self.update();
24        self.uut.update_all();
25    }
26    fn has_changed(&self) -> bool {
27        self.uut.has_changed()
28    }
29    fn accept(&self, name: &str, probe: &mut dyn Probe) {
30        probe.visit_start_scope(name, self);
31        self.uut.accept("uut", probe);
32        probe.visit_end_scope(name, self);
33    }
34}