1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
use super::value::Value;
use super::Path;

pub mod monitor;
pub mod ram;
pub mod mem;
pub mod video;
pub mod riscv_decoder;
pub mod terminal;

pub type PortId = usize;
pub type PortName = String;

pub trait Ext: std::fmt::Debug {
    fn name(&self) -> String;
    fn incoming_ports(&self) -> Vec<PortName> { vec![] }
    fn outgoing_ports(&self) -> Vec<PortName> { vec![] }
    fn instantiate(&mut self, path: Path);
    fn update(&mut self, path: Path, port: &PortName, value: Value) -> Vec<(PortName, Value)>;
    fn clock(&mut self, _path: Path) -> Vec<(PortName, Value)> { vec![] }
    fn reset(&mut self, _path: Path) -> Vec<(PortName, Value)> { vec![] }
}