How models and connections work in NeXosim
mainNeXosim uses a component-oriented architecture inspired by flow-based programming (FBP).
- Models: Isolated entities with fixed typed inputs and outputs. Models are implemented as Rust structs and decorated with the
#[Model]attribute. - Ports/IO: Models communicate via ports (like
Output<T>). Inputs are typically defined as methods on the model, and outputs are fields within the struct. - Connections: Models are linked during bench assembly. You connect an output port of one model to an input method of another using the
.connect()method, passing aMailboxas the communication medium. - Mailboxes: Every model instance requires a
Mailboxto receive messages/events. This acts as the receiver for the model's asynchronous communication channel.
// Example connection pattern
// multiplier1.output connects to multiplier2's input method via multiplier2_mbox
multiplier1
.output
.connect(DelayedMultiplier::input, &multiplier2_mbox);