pub trait Chip {
// Required method
fn tick(&mut self);
}
Expand description
This is intended to be implemented manually by user of the library. This provides the functionality of actually “running” the logic of the chip
Required Methods§
Sourcefn tick(&mut self)
fn tick(&mut self)
this will be called on each clock tick by encompassing module (usually derived by pcb! macro) and should contain the logic which is to be “implemented” by the chip.
Before calling this function the values of input pins wil be updated according to which other pins are connected to those, but does not guarantee what value will be set in case if multiple output pins are connected to a single input pin.
After calling this function, and before the next call of this function, the values of output pins will be gathered by the encompassing module, to be given to the input pins before next call of this.
Thus ideally this function should check values of its input pins, take according actions and set values of output pins. Although in case the chip itself needs to do something else, (eg logging etc) it can simply do that and not set any pin to output in its struct declaration.