system_rust 0.2.16

This is a hardware simulation framework inspired by SystemC for Rust. It features multithreading with a sender-receiver architecture, 4-state logic types, and logging functionality.
Documentation
@startuml
interface ModuleInterface
ModuleInterface : fn new() -> Self

interface ComputeModule
ComputeModule : fn compute(&self)
ComputeModule : fn sensitivity_list(&self) -> Vec<u128>

interface CompositeModule
CompositeModule : fn build(&self, sim: &SimulationContext)

enum L4
L4 : T, F, X, Z
L4 : fn as_bool(&self) -> Option<bool>
L4 : fn arr_to_u8(arr: [L4; 8]) -> Option<u8>
L4 : fn u8_to_arr(val: u8) -> [L4; 8]
L4 : fn arr_to_u32(arr: [L4; 32]) -> Option<u32>
L4 : fn u32_to_arr(val: u32) -> [L4; 32]
L4 : fn arr_to_u64(arr: [L4; 64]) -> Option<u64>
L4 : fn u64_to_arr(val: u64) -> [L4; 64]
L4 : fn not(self) -> Self::Output

struct SRIn
SRIn : fn new() -> Self
SRIn : fn read(&self) -> L4
SRIn : fn attach(&mut self, signal: &Signal)
SRIn : fn attach_resolved(&mut self, signal: &ResolvedSignal)
SRIn : fn set_to(&mut self, other: &SRIn)
SRIn : fn sig_id(&self) -> u128

struct SROut
SROut : fn new() -> Self
SROut : fn write(&self, new_value: L4)
SROut : fn attach(&mut self, signal: &Signal)
SROut : fn set_to(&mut self, other: &SROut)
SROut : fn attach_resolved(&mut self, signal: &ResolvedSignal)

struct Signal
Signal : fn id(&self) -> u128
Signal : fn read(&self) -> L4
Signal : fn write(&self, new_value: L4)

struct ResolvedSignal
ResolvedSignal : fn id(&self) -> u128
ResolvedSignal : fn read(&self) -> L4
ResolvedSignal : fn write(&self, new_value: L4, writer_id: u128)

enum SimDelay
SimDelay : PS(u128), NS(u128), US(u128), MS(u128), S(u128), Min(u128), H(u128), D(u128), Max

struct SimulationContext
SimulationContext : fn add_compute_module<M, F>(&self, name: &str, set_ports: F)
SimulationContext : fn add_composite_module<C, F>(&self, name: &str, set_ports: F)
SimulationContext : fn create_signal(&self, name: &str, initial_value: L4) -> Signal
SimulationContext : fn create_signal_arr<const N: usize>(&self, name: &str, initial_value: L4) -> SignalArr<N>
SimulationContext : fn create_resolved_signal(&self, name: &str, initial_value: L4) -> ResolvedSignal
SimulationContext : fn create_resolved_signal_arr<const N: usize>(&self, name: &str, initial_value: L4) -> ResolvedSignalArr<N>
SimulationContext : fn wait(&self, delay: SimDelay)

struct SimulationControl
SimulationControl : fn new() -> (SimulationControl, SimulationContext)
SimulationControl : fn simulate<F>(&mut self, simulation_instructions: F)
@enduml